home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-24 | 3.7 KB | 98 lines | [TEXT/MPS ] |
- // Copyright © 1994-95 by Apple Computer, Inc. All rights reserved.
- // BetterFeedback.h
-
- /*--------------------------------------------------------------------------------------------------
- This unit attempts to provide smooth flicker-free feedback during command tracking.
-
- T H E O R Y O F O P E R A T I O N
-
- By synchronizing drawing to the vertical retrace interrupt, this unit attempts
- to improve the feedback that mouse trackers provide.
-
- Ideally, this behavior would be part of MacApp's TApplication.TrackMouse method.
- What TApplication.TrackMouse should really do is:
- a) wait for the vertical retrace interrupt of the device that the view most intersects
- b) erase the old tracker feedback by calling tracker.TrackFeedback(…, turn It Off, …)
- c) immediately draw the new feedback by calling tracker.TrackFeedback(…, turn It on, …)
-
- However, with the current architecture, this is impossible. TApplication.TrackMouse currently
- does the following:
- a) call tracker.TrackFeedback(…, turn It Off, …) to erase the previous tracker feedback
- b) call tracker.TrackMouse(trackMove, …) to tell the tracker the track phase
- c) call tracker.TrackFeedback(…, turn It On, …) to draw the new tracker feedback
-
- UBetterFeedbackCmd provides a way to work within the current architecture to provide a close
- attempt at smooth flicker-free feedback. To take advantage of this unit, create a
- subclass of TBetterFeedbackCmd. Then, OVERRIDE TBetterFeedbackCmd::TrackFeedback()
- and as the first statement of this method call:
- Inherited::TrackFeedback(anchorPoint, nextPoint, turnItOn, mouseDidMove);
- so that TBetterFeedbackCmd::TrackFeedback can synch to the vertical retrace interrupt.
- Then the tracker should go ahead and draw/erase the feedback.
-
- For an example, see ShapeCommands: TShapeSketcher, TShapeDragger, and TShapeSelector.
- --------------------------------------------------------------------------------------------------*/
-
- #ifndef __BETTERFEEDBACK__
- #define __BETTERFEEDBACK__
-
-
- #ifndef __UCOMMAND__
- #include <UCommand.h>
- #endif
-
- #ifndef __UCOMMANDHANDLER__
- #include <UCommandHandler.h>
- #endif
-
- //--------------------------------------------------------------------------------------------------
- // Constants
-
- const Boolean kInstall = true; // pass to BetterFeedback: install our VBL?
- const Boolean kBetterFeedbackDesired = true; // pass to IBetterFeedbackCmd: desire better feedback?
-
- //--------------------------------------------------------------------------------------------------
- // CLASS TBetterFeedbackCmd - common ancestor for all commands operating on one or more shapes
- //--------------------------------------------------------------------------------------------------
- class TBetterFeedbackCmd : public TTracker
- {
- MA_DECLARE_CLASS;
-
- public:
- TBetterFeedbackCmd(); // Constructor
- void IBetterFeedbackCmd(CommandNumber itsCommandNumber,
- TCommandHandler* itsContext,
- Boolean canUndo,
- Boolean causesChange,
- TObject* objectToNotify,
- TView* itsView,
- TScroller* itsScroller,
- VPoint itsMouse,
- Boolean betterFeedbackDesired);
-
- virtual void Free(); // Override
-
- // • for tracking
- void BetterFeedback(Boolean install);
- void WaitBetterFeedback();
-
- virtual TTracker* TrackMouse(TrackPhase aTrackPhase,
- VPoint& anchorPoint,
- VPoint& previousPoint,
- VPoint& nextPoint,
- Boolean mouseDidMove); // Override
-
- virtual void TrackFeedback(TrackPhase aTrackPhase,
- const VPoint& anchorPoint,
- const VPoint& previousPoint,
- const VPoint& nextPoint,
- Boolean mouseDidMove,
- Boolean turnItOn); // Override
-
- protected:
- Boolean fBetterFeedbackInstalled; // are the synchronization routines in?
- Boolean fBetterFeedbackDesired; // want the synchronization routines?
- };
-
-
- #endif
-